/**
 * ClassName: AnnotationProviderApplication
 * Package: org.example.provider
 * Description: 基于注解的Dubbo服务提供者启动类
 *
 * @Author BCXJ
 * @Create 2025/10/6 02:15
 * @Version 1.0
 * @Since 1.0
 */
package org.example.provider;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 基于注解的Dubbo服务提供者启动类
 * 提供UserService服务
 */
public class AnnotationProviderApplication {
    
    private static final Logger logger = LoggerFactory.getLogger(AnnotationProviderApplication.class);
    
    public static void main(String[] args) {
        try {
            logger.info("=================================================");
            logger.info("【注解方式】Dubbo服务提供者正在启动...");
            logger.info("=================================================");
            
            // 加载Spring配置文件
            ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
                    "spring/spring-provider-annotation.xml"
            );
            context.start();
            
            logger.info("=================================================");
            logger.info("【注解方式】Dubbo服务提供者启动成功！");
            logger.info("提供服务: UserService (基于@Service注解)");
            logger.info("注册中心: Zookeeper");
            logger.info("服务端口: 20880");
            logger.info("=================================================");
            
            // 保持服务运行
            System.in.read();
            
        } catch (Exception e) {
            logger.error("【注解方式】Dubbo服务提供者启动失败！", e);
        }
    }
}

